<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="css/Tree.css" />
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />
<h1 class="page-title">教材资源管理</h1>
<div class="container_12 clearfix leading">
	<section class="tabs grid_12 leading">
		<ul class="clearfix">
			<li><a href="javascript:void(0)" class="current"
				onclick="loadListContent('/train/res_mater_list.xhtml','mater')">教材上传</a></li>
			<li><a href="javascript:void(0)"
				onclick="loadListContent('/train/res_realia_list.xhtml','realia')">教具申请</a></li>
		</ul>
		<section>
			<section class="clearfix" style="display: block;">
				<header class="grid_12 alpha omega">
					<p>

						筛选： <select id="train_year_mater" style="opacity: 0;">
							<option value="-1">所有年份</option>
							<s:iterator var="year" status="st" value="#request.searchyears">
								<option value="<s:property/>">
									<s:property />
								</option>
							</s:iterator>
						</select> <select id="train_lectype_mater" style="opacity: 0;">
							<option value="-1">所有培训讲师</option>
							<option value="0">内训讲师</option>
							<option value="1">外训讲师</option>
						</select> <select id="train_category_mater" style="opacity: 0;">
							<option value="">所有培训类型</option>
							<s:iterator var="cate" value="#request.categories">
								<option value="${cate.title}">${cate.title}</option>
							</s:iterator>
						</select> <select id="train_lect_mater" style="opacity: 0;">
							<option value="-1">所有讲师</option>
							<s:iterator var="lecturer" value="#request.lecturers">
								<option value="${lecturer.employeeinfoWork.id}">${lecturer.employeeinfoWork.baseId.name}</option>
							</s:iterator>
						</select>
						<span> <input type="button" value="点击搜索"
	                                      onclick="javascript:searchClickEvent('/train/res_mater_list.xhtml','mater')"></span>
					</p>
				</header>
				<div class="clearfix" id="list_content_mater"></div>
			</section>
			<section class="clearfix" style="display: block;">
				<header class="grid_12 alpha omega">
					<p>
						筛选： <select id="train_year_realia" style="opacity: 0;">
							<option value="-1">所有年份</option>
							<s:iterator var="year" status="st" value="#request.searchyears">
								<option value="<s:property/>">
									<s:property />
								</option>
							</s:iterator>
						</select> <select id="train_lectype_realia" style="opacity: 0;">
							<option value="-1">所有培训讲师</option>
							<option value="0">内训讲师</option>
							<option value="1">外训讲师</option>
						</select> <select id="train_category_realia" style="opacity: 0;">
							<option value="">所有培训类型</option>
							<s:iterator var="cate" value="#request.categories">
								<option value="${cate.title}">${cate.title}</option>
							</s:iterator>
						</select> <select id="train_lect_realia" style="opacity: 0;">
							<option value="-1">所有讲师</option>
							<s:iterator var="lecturer" value="#request.lecturers">
								<option value="${lecturer.employeeinfoWork.id}">${lecturer.employeeinfoWork.baseId.name}</option>
							</s:iterator>
						</select>
						<span> <input type="button" value="点击搜索"
	                                      onclick="javascript:searchClickEvent('/train/res_realia_list.xhtml','realia')"></span>
						</p>
				</header>
				<div class="clearfix" id="list_content_realia"></div>
			</section>
		</section>
	</section>
</div>

<div class="clear"></div>
<script type="text/javascript">
	var curResType = "mater";
	$(function() {
		setTimeout('loadListContent("${ctx}${listAction}", "mater")', 600);
	})

	function loadListContent(url, resourceType) {
    	curResType = resourceType;
		var data = {
			"organizationId":${organizationId},
			"resourceType" : curResType,
			"year" : $("#train_year_" + curResType).val(),
			"lecturerType" : $("#train_lectype_" + curResType).val(),
			"category" : $("#train_category_" + curResType).val(),
			"workId" : $("#train_lect_" + curResType).val(),
		};
		//refreshListContent(url, data);
		$.ajax(url, {
			type : "POST",
			data : data,
			dataType : "html",
			cache : false,
			success : function(a) {
				var obj = $("#list_content_" + curResType);
				obj.html("");
				obj.append(a);
			},
			complete : function() {
			}
		});
	}
	
	   /**
     * 刷新数据
     */
    function searchClickEvent(url,resType) {
        loadListContent(url, resType);
    }
	
</script>